import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:todo_app/pages/providers/theme/theme_provider.dart';
import 'package:todo_app/pages/todos_page.dart';

void main() {
  runApp(ProviderScope(child: const MainApp()));
}

class MainApp extends ConsumerWidget {
  const MainApp({super.key});

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    final currentTheme = ref.watch(themeProvider);
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Todos',
      theme:
          currentTheme == AppTheme.light
              ? ThemeData.light(useMaterial3: true)
              : ThemeData.dark(useMaterial3: true),
      home: TodosPage(),
    );
  }
}
